package com.prototype.demo01;

/**
 * 原型模式
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        ConcretePrototype p1 = new ConcretePrototype();
        p1.clone();
        Object clone = p1.clone();
        System.out.println(p1);//com.prototype.demo01.ConcretePrototype@31befd9f
        System.out.println(clone);//com.prototype.demo01.ConcretePrototype@1c20c684

        // CloneNotSupportedException
        Client client = new Client();
        client.clone();


    }

    // Person 不是 Object 的子类么?为何不给 clone()
//    public static void testCase1(){
//        Person person = new Person();
//        person.clone();
//    }
}
